<template>
  <el-breadcrumb separator="/">
    <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
    <el-breadcrumb-item v-for="item in breads" :to="item.path">{{ item.meta.title == "首页" ? '' : item.meta.title }}</el-breadcrumb-item>
  </el-breadcrumb>
</template>

<script setup lang='ts'>
import {ref ,watch} from 'vue'
import type {RouteLocationMatched} from 'vue-router'

import {useRoute} from "vue-router"
const route = useRoute()
const breads = ref<any>([])
watch(route,(newval)=>{
    breads.value = newval.matched.filter((v,i)=>i>0)
},{immediate:true})
</script>

<style lang='less' scoped>
</style>